﻿@using NewRen.Models;
@model NewRen.Models.Topic

@{
    List<Plate> plates = ViewBag.platelist as List<Plate>;
    ViewBag.Title = "增加主题";
    Layout = "~/Views/Shared/_Layout_Bbs.cshtml";
}
<div class="container_wrap wrap_990 clearfix">
    <div class="postwrap">
        <div class="postcon">
            <div class="title clearfix">
                <span>发表新主题</span>
            </div>

            <div class="invitationcon edui-default">
                @using (Html.BeginForm("Add", "Bbs", FormMethod.Post, new { id = "myform" }))
                {
                    @Html.AntiForgeryToken()
                    <div class="importtopic clearfix">
                        @*<span class="label">还可输入 60 个字符</span>*@
                        <input type="text" placeholder="标题" name="title" id="posttitle">
                        <select name="classify" id="catid" class="classify">
                            @if (ViewBag.plateID != 0) 
                            { 
                                <option value="@ViewBag.plateID">@ViewBag.ptitle </option>
                            }
                            else
                            { 
                                 <option value="">请选择模块</option>
                                 foreach (Plate plate in plates)
                                 {
                                     <option value="@plate.ID">@plate.Title</option>
                                 }
                            }
                        </select>
                    </div>
                    <input type="hidden" name="userid" value="1">
                    <script id="container" name="content" type="text/plain">
                    </script>
                    <div class="session3 clearfix">
                        <span>@Html.ValidationSummary(true)</span>
                        <input type="button" onclick="validateEditor()" value="发布帖子" class="button yellow w-1 h-s-4" />
                    </div>
                }
                <!-- 配置文件 -->
                <script type="text/javascript" src="~/Scripts/ueditor/ueditor.config.js"></script>
                <!-- 编辑器源码文件 -->
                <script type="text/javascript" src="~/Scripts/ueditor/ueditor.all.js"></script>
                <!-- 实例化编辑器 -->
                <script type="text/javascript">
                    var ue = UE.getEditor('container', { initialFrameHeight: 320 });
                </script>
                <script>
                    var user = $("#hdusername").val();
                    if(user == undefined)
                    {
                        CastMsg("请先登录，再进行发布！");
                    }
                </script>
            </div>
        </div>
    </div>
</div>